class UserController {

    def register = {
        
    }

    def create = {
        def user = new User(params)
        if(!user.hasErrors() && user.save()) {
            log.debug("${user} created!")
            session.user_id = user.id
            if(user.firstName) {
                session.user_firstName = user.firstName
            }
            
            flash.message = "Welcome ${user.firstName}! Let's get started..."
            redirect(controller: "profile", action: "dashboard")
        } else {
            flash.message = "There is a problem with your membership. Please review and correct the errors below..."
            render(view: "register", model: [user:user])
        }
    }
}
